<template>
  <div class="sidebar">
    <div class="nav-menu">
      <div
        class="nav-item"
        :class="{ active: $route.path === '/' }"
        @click="navigateTo('/')"
      >
        <span class="nav-icon">🏠</span>
        <span class="nav-text">首页</span>
      </div>
      <div
        class="nav-item"
        :class="{ active: $route.path === '/user-info' }"
        @click="navigateTo('/user-info')"
      >
        <span class="nav-icon">👤</span>
        <span class="nav-text">个人中心</span>
      </div>
      <div
        class="nav-item"
        :class="{ active: $route.path === '/cart' }"
        @click="navigateTo('/cart')"
      >
        <span class="nav-icon">🛒</span>
        <span class="nav-text">购物车</span>
      </div>
      <div
        class="nav-item"
        :class="{ active: $route.path === '/customer-orders' }"
        @click="navigateTo('/customer-orders')"
      >
        <span class="nav-icon">📋</span>
        <span class="nav-text">订单管理</span>
      </div>
      <div
        class="nav-item"
        :class="{ active: $route.path === '/ai-chat' }"
        @click="navigateTo('/ai-chat')"
      >
        <span class="nav-icon">🤖</span>
        <span class="nav-text">AI 问答</span>
      </div>
      <div
        class="nav-item"
        :class="{ active: $route.path === '/become-seller' }"
        @click="navigateTo('/become-seller')"
      >
        <span class="nav-icon">🏪</span>
        <span class="nav-text">成为商家</span>
      </div>
    </div>
    <div class="sidebar-footer">
      <div class="copyright">© 2024 猫咖商店</div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'AppSidebar',
  data() {}, methods: {
    navigateTo(path) {
      this.$router.push(path);
    }
  }
}
</script>

<style scoped>
.sidebar {
  width: 190px;
  min-width: 220px;
  height: calc(100vh - 50px);
  background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  position: fixed;
  left: 0;
  top: 50px;
  z-index: 800;
  transition: transform 0.3s ease;
}

.nav-menu {
  flex: 1;
  padding: 60px 0 20px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 4px;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: white;
  padding-left: 24px;
}

.nav-item.active {
  background-color: rgba(102, 126, 234, 0.2);
  color: white;
  border-left-color: #667eea;
  font-weight: 500;
}

.nav-icon {
  font-size: 18px;
  margin-right: 12px;
}

.nav-text {
  font-size: 14px;
}

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.copyright {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  text-align: center;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }
}
</style>
